using System;
using MessagePack;

namespace Gj.MapData.Strategy
{
    public class DynamicIntArray
    {
        public static int[] Parse(byte[] data)
        {
            var value = MessagePackSerializer.Deserialize<object[]>(data);
            var a = new int[value.Length];
            for (var i = 0; i < a.Length; i++) a[i] = Convert.ToInt32(value[i]);
            return a;
        }

        public static byte[] Format(int[] array)
        {
            return MessagePackSerializer.Serialize(array);
        }
    }
}